﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UlsStudio.DesktopApp.Controls
{
    public partial class LineStylePicker : UserControl
    {
        #region Constructor & Privates

        public LineStylePicker()
        {
            InitializeComponent();
        }

        private string _exampleText = string.Empty;
        private string _label = string.Empty;
        private Color _foreGroundColour = Color.Black;
        private Color _backGroundColour = Color.White;

        #endregion

        #region Properties

        /// <summary>
        /// Background colour to be displayed for this type of log entry
        /// </summary>
        public Color LineBackColour
        {
            get { return _backGroundColour; }
            set 
            {
                textBox1.BackColor = value;
                _backGroundColour = value; 
            }
        }

        /// <summary>
        /// Text colour to be displayed for this type of log entry
        /// </summary>
        public Color LineForeColour
        {
            get { return _foreGroundColour; }
            set 
            {
                textBox1.ForeColor = value;
                _foreGroundColour = value; 
            }
        }

        /// <summary>
        /// An example of what this style will look like
        /// </summary>
        public string ExampleText
        {
            get { return _exampleText; }
            set 
            {
                textBox1.Text = value;
                _exampleText = value; 
            }
        }

        /// <summary>
        /// Type of log-entry
        /// </summary>
        public string Label
        {
            get { return _label; }
            set 
            {
                label1.Text = value;
                _label = value; 
            }
        }

        #endregion


        private void btnChangeCritical_MouseClick(object sender, MouseEventArgs e)
        {
            contextMenuStrip1.Show(btnChange, e.X, e.Y);
        }

        private void foregroundToolStripMenuItem_Click(object sender, EventArgs e)
        {
            colorDialog1.Color = this.LineForeColour;
            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                this.LineForeColour = colorDialog1.Color;
            }
        }

        private void backgroundToolStripMenuItem_Click(object sender, EventArgs e)
        {
            colorDialog1.Color = this.LineBackColour;
            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                this.LineBackColour = colorDialog1.Color;
            }
        }
    }
}
